<template>
  <div>
    <span class="returnIn" @click="returnIndex">&lt;</span>

    <div class="news-list">
      <div class="temps " v-for="(item,index) in NewsList" :key="index" @click="gotoArticle(index)">
        <div class="title">
          <span>{{item.texttitle}}</span>
        </div>
        <div class="text">
          <span>{{item.author}}</span>
          <span>{{item.identity}}</span>
        </div>
        <div class="pic">
          <span>{{item.introduction}}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "NewsList",
  data() {
    return {
      NewsList:{}
    }
  },
  methods: {
    gotoArticle(index){
      console.log(index)
      this.$router.push({
        path:'/indextext',
        name:'indextext',
        params:{
          id:index
        }
      })
    },
    getNewsList(){
      let texttitle=this.$route.params.texttitle
      console.log(this.$route.params)
      axios.post("http://localhost:9999/findList",{params:texttitle}).then((res)=>{
        this.NewsList=res.data.data;
      })
    },
    returnIndex(){
      this.$router.push("/index")
    }
  },
  created() {
    this.getNewsList();
  }
}
</script>

<style scoped>

.news-list {
  z-index: 1;
  position: relative;
  top: 40px;
  /*background-color: rgba(143, 143, 143,0.2);*/
  background-color: #f7f7f7;

  /*bottom: 70px;*/
}

.news-list .temps {
  margin-top: 5px;
  background-color: white;
  height: 120px;
  width: 100%;
  border-bottom: 1px solid #d6d6d6;
  border-top: 1px solid #f2f2f2;
  /*box-shadow:0px 12px 8px -12px #d6d6d6;*/
}

.news-list .title {
  color: black;
  font-weight: bold;
  font-size: 18px;
}

.news-list .text {
  color: #cccccc;
  font-size: 12px;
}

.news-list .text span:nth-child(1) {
  color: black;
  font-weight: bold;
  font-size: 13px;
}

.returnIn{
  font-size: 50px;
}

</style>